<?php
	##############
	#	HOCTIL NDS     #
	###################################################################################
 
 /**
    * FILE:          		admin.php
    * LOCATION:      /root
    * FUNCTION:      
    * DEPENDENCIES:  phpheader.php, db_connect.php, core_functions.php, pagination.class.php
    * ==============================================================================
    * @version $Id: cieEdit.php,v 0.2 2009/01/01
    * @copyright Copyright (c) none
    * @author ChrisV
    * ==============================================================================
    */
	
	#start a session because we are logged in
	session_start();
	#show errors
	error_reporting(0);
	
	##############
	#	dependencies    #
	##############
	include('./includes/db_connect.php');
	include('includes/phpheader.php');
	require_once('./core_lib/core_functions.php');
	include_once('./classes/pagination.class.php'); 
	
	#verify the user login
	if(!isset($_SESSION['logged_in'])){
		#user not logged in properly
		return_to_login_page();
	}else{	
			###########################################
			# we have a valid user.  lets construct the logged in user object  #
			###########################################
			
			#username
			$loggedIn = sanitize($_SESSION['logged_in']);
			#userid
			$user_id = sanitize($_SESSION['user_id']);
			#location
			$location = sanitize($_SESSION['location']);
			#user position
			$user_position = sanitize($_SESSION['user_position']);
			#user position
			$user_access_level = sanitize($_SESSION['user_access_level']);
			#user ip address
			$user_ip = $_SERVER['REMOTE_ADDR'];
			
			# verify user's location 
			$query = "SELECT location 
						FROM lst_location 
						WHERE  id = '".$location."'";
			$location_result = mysql_query($query);
			while($row=mysql_fetch_assoc($location_result)){		
					$assigned_location = $row['location'];
			}
	}
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" 
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
	<head>
		<title><?php echo THIS_CIL;?> Navigational Database System :  Profile Screen For <?php echo $loggedIn;?></title>
		<meta http-equiv="content-type" content="text/html; charset=utf-8" />
		<meta http-equiv="Expires" content="Tue, 01 Jan 1980 1:00:00 GMT" />
		<meta http-equiv="Pragma" content="no-cache" />
		
		<!-- for profiles-->
	   	<link rel="stylesheet" href="css/profile_style.css" type="text/css" media="screen, projection" />
		<!--[if IE 6]>
			<link rel="stylesheet" href="ie6.css" />
		<![endif]-->
		
		<link rel="stylesheet" href="css/reset-fonts.css" type="text/css" media="screen, projection" />
		<link rel="stylesheet" href="css/gt-styles.css" type="text/css" media="screen, projection" />
		
<?php
	# need to integrate jquery here.  jquery will need to run in NO-CONFLICT MODE
?>
		<!-- handles inline UI features -->
		<script src="./script/prototype.js" type="text/javascript"></script>
		<script src="./script/scripts.js" type="text/javascript"></script>
		<script src="./script/messages.js" type="text/javascript"></script>
		
		
		<style type="text/css">
			a.memberlogin {background-image: none;}
			#header{border-bottom:3px solid #CECEF6;}
			#navigation{margin-top:3em; margin-left: 5em; width: 535px;}
			span.hilight{color:red; font-weight:bold;}
			#sidebar p{padding-left: 80px; padding-top: 1px;}
			span.stats{padding:4px; border:1px solid #585858; background-color: #eee; font-weight:bold; margin-right: 3px;}
			img.propertyaccount{border: 2px solid #FE2E2E; margin-right:5px;}
			img.locatoraccount{border: 2px solid #04B404; margin-right:5px;}
			.viewthis{padding:4px; border:1px solid #585858; background-color: #eee; font-weight:bold; }
			.emphasis{color:#ff0000; font-weight:bold;}
		</style>
	</head>
	<body>
		<!-- head -->
		<div class="gt-hd clearfix">
			<!-- logo -->
			<div class="gt-logo">
				<?php echo THIS_CIL;?>'s Navigational Database System
			</div>
			<!-- / logo -->
			<!-- utility box -->
			<div class="gt-util-box">
				<div class="gt-util-box-inner">
					<p>Welcome <strong><?php echo $loggedIn;?></strong> | <a href="./actions/ProcessLogout.php">logout</a></p>
				</div>
			</div>
			<!-- / utility box -->
			
			<!-- navigation -->
			<div class="gt-nav">
				<ul>
				  <!-- module links -->
					<li>
							<a href="./admin.php" title="Click here to get on your database home page."
									style="color:#2e2e2e;">
								Home Page
							</a>
					</li>
					<li>
						<a href="admin.php?action=cie" title="Manage consumer case files."
								style="color:#2e2e2e;">
							Consumer Files
						</a>
					</li>
					<li>
						<a href="admin.php?action=community_totals_list" style="color:#2e2e2e;" title="Manage community activity data">
							Community  Activities
						</a>
					</li>
					<li>
						<a href="admin.php?action=ir" title="Enter general public information and referral data here."
								style="color:#2e2e2e;">
							Public I&amp;R
						</a>
					</li>
					<!--
					<li>
						<a href="" style="color:#2e2e2e;" title="Enter Modules needed for your programs">
							Programmatic Modules
						</a>
					</li>
					-->
				</ul>
			</div>
			<!-- / navigation -->
		
		</div>
		<!-- / head -->
		
		
		<!-- body -->
		<div class="gt-bd gt-cols clearfix" style="padding-top:20px;">
			<!-- breadcrumb 
			<div class="gt-breadcrumb" style="margin-bottom: 15px; border:none;">
			</div>
			/ breadcrumb -->
			<!-- main content -->
<?php 
		# actions here determine the CURRENT USER VIEW.
		# pages rendered by $action do not process any consumer
		# database information.
		
		$action = (string)sanitize($_GET["action"]);
		
		#validate action request. if $action is not pre-defined by action_check(),
		#the error page will render
		$action_verification = action_check($action);
		if($action_verification){
					#handle content layout
					echo "<!-- main content -->";
					echo "<div class=\"gt-content\">";
					
					if($action=="cie") {
							#SEARCH for consumer records		
							include("$BASE/views/cieSearch.php");
					} else if($action=="cielistall") {
							#LIST all consumers in database	
							include("$BASE/views/cieListAll.php");
					} else if($action=="cielistquery") {
							#LIST query results from database	
							include("$BASE/views/cieListQuery.php");
					}else if($action=="community_totals_list") {
							#LIST user community totals 
							include("$BASE/views/community_totals_list.php");
					}else if($action=="community_totals") {
							#RENDERS community totals entry form	
							include("$BASE/forms/community_totals.php");
					}else if($action=="cieedit") {
							#RENDERS consumer file tab
							include("$BASE/views/cieEdit.php");
					}else if($action=="ir") {
							#RENDERS information and referral entry form
							include("$BASE/forms/irEntry.php");
					} else if($action=="enroll") {
							#RENDERS program enrollement form
							include("$BASE/forms/enroll.php");
					}else{
							#we have some sort of error, so handle it if the user gets this far
							include("$BASE/views/error.php");
					}
		}else{
				##########################
				##MAIN PROFILE DASHBOARD 
				##########################
				
				#Render initial welcome page because we don't 
				#have an action command
?>
				<!-- PROFILE BOX -->
				<div id="content">
					<h1 style="font-size:3em;">Welcome to NDS !</h1>
					<div id="xs_main" style="padding-bottom:0.5em;padding-top:0.5em;">
						<table>
							<tr>
								<td>
									<img src="./images/<?php echo THIS_CIL;?>_logo.gif" style="float:left; margin-left:70px;padding-bottom:20px;">
								</td>
							</tr>
							<tr>
								<td>
									<?php
										#need to activate this form so users can control basic profile settings
									?>
									<form action="#" method="post" enctype="multipart/form-data">
										<input name="target" value="#" type="hidden">
											<fieldset>
												<h2 class="first">Your NDS Profile Information</h2>
												<h3>System ID #: <?php echo $user_id;?></h3>
												<h3>Your Access Level: <span class="emphasis"><?php echo $user_access_level;?></span></h3>					
												<h3>Your Location: <strong><?php echo $assigned_location;?></strong></h3>
												<h3>Your Current Position: <strong><?php echo $user_position;?></strong></h3>
												<h3>User Created On: <strong>October 23, 2008</strong></h3>
												<dl>
													<dt><label for="employeename"><?php echo THIS_CIL;?> Employee Name</label></dt>
													<dd><input title="View your employee name" name="employeename" value="<?php echo $loggedIn;?>" id="employeename" class="textfield required" type="text" readonly="readonly"></dd>
												</dl>
												<dl>
													<dt><label>Contact Email</label></dt>
													<dd class="textonly"><?php echo $loggedIn;?>@hoctil.org &nbsp;&nbsp;&nbsp;&nbsp;
														<small> <a href="#" title="Edit your email information">Change</a></small>
													</dd>
												</dl>
												<dl>
													<dt><label>Account Password</label></dt>
													<dd class="textonly"><strong>@ @ @ @ @ @ @</strong>&nbsp;&nbsp;&nbsp;&nbsp;
														<small><a href="#" title="Edit your NDS password information">Change</a></small>
													</dd>
												</dl>
												<div class="clear"></div> <!-- for IE because its balls -->
												<h2>Profile Image For: <?php echo $loggedIn;?></h2>  
												<dl id="profile-photo">
													<dt>
														<img class="photo" src="./images/account_pic.png" alt="Your Property Photo">
													</dt>
													<dd class="textonly">
														NDS allows you to customize your profile.  Upload a single image
														to represent your account.  This image will be used as your personal avatar for messages
														sent to others in the system.
														<br />
														<small class="note">GIF, JPG and PNG file formats accepted</small>
													</dd>
													<dd style="margin-top: 1em; margin-left:25px;">
														<input title="Upload your pic" name="photo" value="" class="file" id="signup_avatar" type="file">
													</dd>
													<p class="buttons">
														<button type="submit">Update</button>
														<br />
													</p>
												</dl>

												<h2>Case File Highlights</h2>
												<!-- #1-->
												<dl>
													<h3 style="padding-top:10px;">Last 3 Files Created:</h3>
													<dt style="width:135px; padding-bottom:10px;">
														<label style="width:135px;"for="newfile1">New Consumer 1</label>
														<br><a href="#" title="View Consumer 1's case file">View</a>
													</dt>
													<dt style="width:135px; padding-bottom:10px;">
														<label style="width:135px;"for="newfile2">New Consumer 2</label>
														<br><a href="#" title="View Consumer 2's case file">View</a>
													</dt>
													<dt style="width:135px; padding-bottom:10px;">
														<label style="width:135px;"for="newfile3">New Consumer 3</label>
														<br><a href="#" title="View Consumer 3's case file">View</a>
													</dt>
												</dl>
												<!-- #2 -->
												<dl>
													<h3 style="padding-top:10px;">Last 3 Files Edited / Updated:</h3>
													<dt style="width:135px; padding-bottom:10px;">
														<label style="width:135px;"for="editedfile1">Edited Consumer 1</label>
														<br><a href="#" title="View Edited Consumer 1's case file">View</a>
													</dt>
													<dt style="width:135px; padding-bottom:10px;">
														<label style="width:135px;"for="editedfile2">Edited Consumer 2</label>
														<br><a href="#" title="View Edited Consumer 2's case file">View</a>
													</dt>
													<dt style="width:135px; padding-bottom:10px;">
														<label style="width:135px;"for="editedfile3">Edited Consumer 3</label>
														<br><a href="#" title="View Edited Consumer 3's case file">View</a>
													</dt>
												</dl>
											</fieldset>
										</form>
										<div class="clear"></div>
									</td>
								</tr>
							</table>
					</div>
					<!--end xs main -->
					<script type="text/javascript">document.getElementById('employeename').focus()</script>
				</div>
				<!-- END PROFILE BOX -->
							
				<!-- PROFILE right-side -->
				<div id="sidebar">
					<div id="secondary">
						<h3>Profile Quick Stats</h3>
						<div class="person" style="padding-bottom:2em;">
							<ul>
								<li><span class="stats">Logged In From: </span><?php echo $user_ip?></li>
								<li><span class="stats">I&amp;R Instances (this month): </span> 202</li>
								<li><span class="stats">Outcome Indicators Met (this month): </span> 39<small> <a href="#" title="View list of outcomes you helped consumers achieve">View</a></small></li>
								<li><span class="stats">Total Files in Caseload: </span> 68</li>								
								<li style="background:  url(./images/exclamation.gif) left no-repeat;"><span class="stats">New Files Created (this quarter): </span> 10<small> <a href="#" title="View case file goal">View Goal</a></small></li>
								<li><span class="stats">Files in Compliance: </span> 60</li>	
								<li style="background:  url(./images/exclamation.gif) left no-repeat;"><span class="stats">ILP's To Expire(next 30 days): </span> 5<small> <a href="#" title="View files with ILPs about to expire">View Files</a></small></li>
								<li style="background:  url(./images/exclamation.gif) left no-repeat;"><span class="stats">Expired ILPs: </span> 3<small> <a href="#" title="View files with expired ILPs">View Files</a></small></li>
								<li><span class="stats">Reports Due (this month): </span>3<small> <a href="#" title="View list of reports due this month">View List</a></small></li>
								<li style="background:  url(./images/exclamation.gif) left no-repeat;"><span class="stats">Reports Submitted: </span> 1<small> <a href="#" title="View list of reports submitted this month">View Reports</a></small></li>
							</ul>
						</div>
						
						<h3 style="margin-top:1em; margin-bottom:0.5em;">
							Recent Messages From <br /><?php echo THIS_CIL;?> Administration
						</h3>
						<div>
							<p style="padding:15px 0px 15px 5px; font-size:1.1em">
								<a href="#" 
								    title="Click to get full details about Message #1"
									style="font-weight:bold;">
									Message #1: Title of Message
								</a>
								<br /><br />
								We could put some teaser information about the information /
								announcement you want to give users with this specific account
								type.  Then the would just <a href="#" title="click here to read more">click here</a> to read the 
								rest of the message, or they could click on the message title to get to
								the same place.
							</p>
						</div>
						<div>
							<p style="padding:15px 0px 15px 5px; font-size:1.1em;">
								<a href="#" 
								    title="Click to get full details about Message #2"
									style="font-weight:bold;">
									Message #2: Title of Message
								</a>
								<br /><br />
								We could put some teaser information about the information /
								announcement you want to give users with this specific account
								type.  Then the would just <a href="#" title="click here to read more">click here</a> to read the 
								rest of the message, or they could click on the message title to get to
								the same place.
							</p>
						</div>
					</div>	
				</div>
				<!-- END PROFILE right box -->
				<div id="separator">	
				<br /><br /><br />
				<!-- footer -->
				<div class="gt-footer">
					<p style="text-align:left;">
						<strong>The login session listed below is valid until you logout and close your browser.</strong>    
						<span style="text-align:right;">Copyright &copy; 2008  - 2009 
						<a href="http://www.valleyassociation.org/" target="_blank">VAIL CIL</a>
						</span>
					</p>
					<p style="border:2px solid #424242;
									padding: 4px; background-color:#F2F5A9;
									color:#000; font-weight:bold;
									float:left;">Secure Session ID: <?php echo session_id();?>
					</p>
				</div>
			      <!-- /footer -->
		<?php
		}
		?>
	</body>
</html>